package com.srv.servlet;

import org.codehaus.jackson.map.ObjectMapper;

public class ResponseResult_Json {
	 public ResponseResult_Json(ResponseResult result){
		 if(result.theResult==ResponseResult.RESULT_FAIL){
			 this.r=ConstText.JSON_FAIL;
		 }
		 this.m=result.theMessageObj;
	 }
     /**
      * 返回结果
      */
     public String r = ConstText.JSON_OK;
     /**
      * 消息体
      */
     public Object m = null;
     
     /**
 	 * 转换成UTF-8的Json
 	 * @return
 	 */
     public String toJson_utf8() throws Exception{
     	ObjectMapper mapper = new ObjectMapper();
         mapper.registerSubtypes(ResponseResult_Json.class);
     	return mapper.writeValueAsString(this);    	                
     }
}
